"use strict"
/**
 *
 * @param {import("egg").Application} app
 */
module.exports = app => {
	const Sequelize = app.Sequelize
	const sequelize = app.model
	const UnionUser = sequelize.define("unionUser", {
		// account: Sequelize.STRING(32),//mail //或者其他
		create_at: {
			type: Sequelize.DATE,
			defaultValue: sequelize.literal("CURRENT_TIMESTAMP"),
			get() {
				return Date.parse(this.getDataValue("create_at"))
			}
		},
		last_login: {
			type: Sequelize.DATE,
			defaultValue: sequelize.literal("CURRENT_TIMESTAMP"),
			get() {
				return Date.parse(this.getDataValue("last_login"))
			}
		},
		stat: {
			type: Sequelize.TINYINT
		},
		nickname: Sequelize.STRING(50),
		sex: {
			type: Sequelize.TINYINT,//
			comment: "性别 0女 1男 "
		},
		language: Sequelize.STRING(10),
		city: Sequelize.STRING(20),
		province: Sequelize.STRING(20),
		country: Sequelize.STRING(20),
		headimg_url: Sequelize.STRING,

		unionid: {
			type: Sequelize.STRING(40),
			comment: "unionid",
			unique: true
		},
		/*  subscribe: Sequelize.BOOLEAN,
			subscribe_time: Sequelize.DATE,
			subscribe_scene: Sequelize.STRING,
			qr_scene: Sequelize.STRING,
			qr_scene_str: Sequelize.STRING, */
	}, {
		timestamps: false,
		charset: "utf8",
		tableName: "union_user"
	})
	// UnionUser.removeAttribute("id");
	UnionUser.Stat = {
		del: 0,
		base: 1,
	}
	return UnionUser
}
